//package com.zlx.store.user.AOP;
//
//
//import cn.hutool.jwt.JWT;
//import cn.hutool.jwt.signers.JWTSigner;
//import cn.hutool.jwt.signers.JWTSignerUtil;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.zlx.store.common.annotation.CreateJWTAnno;
//import com.zlx.store.common.constant.JWTSecurityKey;
//import com.zlx.store.common.constant.RespCode;
//import com.zlx.store.common.results.HttpResp;
//import com.zlx.store.common.util.StringTool;
//import com.zlx.store.domain.entity.StoreRelateUser;
//import com.zlx.store.domain.entity.User;
//import com.zlx.store.user.dao.StoreRelateUserTabDao;
//import com.zlx.store.user.dao.UserDao;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.AfterReturning;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Pointcut;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import org.springframework.stereotype.Component;
//
//import java.nio.charset.StandardCharsets;
//import java.util.Date;
//import java.util.List;
//import java.util.stream.Collectors;
//
//@Aspect
//@Component
//public class JWTCreator {
//    @Autowired
//    private UserDao userDao;
//    @Autowired
//    private StoreRelateUserTabDao storeRelateUserTabDao;
//
//    @Pointcut("@annotation(com.zlx.store.common.annotation.CreateJWTAnno)")
//    private void annotationPointCut() {
//
//    }

//    @Around("annotationPointCut() && @annotation(createJWTAnno) && args(..)")
//    private HttpResp createJWT(ProceedingJoinPoint pjp, CreateJWTAnno createJWTAnno) {
//        if (createJWTAnno.type().equals("input")) {
//            Object[] args = pjp.getArgs();
//            if ()}
//        ;
//        return HttpResp.httpResp(RespCode.USER_LOGIN_SUCCESS, null, new Date());
//    }
//}


//        if (returnValue.getRespCode().equals(RespCode.USER_OPERATION_SUCCESS)) {
//            String username = request.getParameter("username");
//            String password = request.getParameter("password");
//            String input = request.getParameter("input");
//            if (StringTool.isEmailLegal(input)) {
//                User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getUserEmail, input));
//            }
//            if (StringTool.isChinaPhoneLegal(input)) {
//                User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getUserPhoneNumber, input));
//            }
//            User user = userDao.selectOne(new LambdaQueryWrapper<User>().eq(User::getUserName, username).eq(User::getUserPassword, password));
//            List<Long> storeIdList = storeRelateUserTabDao.selectList(
//                    new LambdaQueryWrapper<StoreRelateUser>()
//                            .eq(StoreRelateUser::getUserId, user.getUserId())).stream()
//                    .map(StoreRelateUser::getStoreId).collect(Collectors.toList());
//            JWTSigner jwtSigner = JWTSignerUtil.hs256(JWTSecurityKey.SECURITY_KEY.key.getBytes(StandardCharsets.UTF_8));
//            String jwt = JWT.create().setSigner(jwtSigner)
//                    .setPayload("username", user.getUserName())
//                    .setPayload("userId", user.getUserId())
//                    .setPayload("userRole", user.getUserRole())
//                    .setPayload("storeIds", storeIdList).toString();
//
//    }

